//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2009 Manu Mital mital.manu@gmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

// MainFrm.h : interface of the CMainFrame class
//



#pragma once

#include "Devotional.h"
#include "VerseLists.h"
#include "Hangman.h"
#include "toolbar/TCToolBar.h"
#include "BaseDialog.h"
#include "BaseTreeDialog.h"
#include "MenuCH.h"


////////////////////////////////////////////////////////////


class CMainFrame : public CFrameWnd
{
	
protected: // create from serialization only
	CMainFrame();
	DECLARE_DYNCREATE(CMainFrame)


// Attributes
public:
  CBaseDialog     m_bibleDlg;
  CBaseDialog     m_comDlg;
  CBaseDialog     m_dictDlg;
  CBaseTreeDialog m_treeDlg;

private:
	CDevotional * m_pModeless;
	BOOL m_bPreview;  // TRUE in print preview mode; FALSE otherwise
  CStringArray bookmarks;
	
public:
	 	static CVerseLists    * m_pModelessVL;  // static so that search class can access this
   CFont *  pFont;

// Overrides
public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	void Normal() { OnNormal(); }

// Implementation
public:
	virtual ~CMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:  // control bar embedded members
	CStatusBar  m_wndStatusBar;
	CTCToolBar    m_wndToolBar;
	 
public:
	CTCToolBar   m_wndQuickVerseBar;
	CComboBox QuickVerseCombo;
  CMenuCH   m_mainMenu, m_FileMenu, 
    m_OptionsMenu, m_ViewMenu, m_BookmarksMenu,m_HelpMenu;


// Generated message map functions
protected:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnTopMax();
	afx_msg void OnBottomMax();
	afx_msg void OnNormal();
	afx_msg void OnSubMenuBookMarks(UINT nID);
	afx_msg LRESULT OnShowDevotional(WPARAM wParam, LPARAM lParam);

	DECLARE_MESSAGE_MAP()
public:

  afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnDeleteBookmark();
	afx_msg void OnAddBookmark();
	afx_msg void OnMenuBiblepageSearch();
	afx_msg void OnBottomSearch();
	afx_msg void OnMainDisplay();
	afx_msg void OnBottomDisplay();
	// load the bookmarks from the registry into the mainframe  menu
	void LoadBookmarks(void);

	afx_msg void OnViewDevotional();
	afx_msg void OnVerseLists();
  afx_msg void OnScriptureChallenge();
	afx_msg void OnWeb();
	afx_msg void OnInstallMgr();
  afx_msg void OnHelp();


	afx_msg void OnLemma();
	afx_msg void OnUpdateLemma(CCmdUI * pCmdUI);

	afx_msg void OnMorph();
	afx_msg void OnUpdateMorph(CCmdUI * pCmdUI);
	
	afx_msg void OnFootnotes();
	afx_msg void OnUpdateFootnotes(CCmdUI *pCmdUI);
	
	afx_msg void OnCrossref();
	afx_msg void OnUpdateCrossref(CCmdUI *pCmdUI);

	afx_msg void OnHeading();
	afx_msg void OnUpdateHeading(CCmdUI *pCmdUI);

	afx_msg void OnRed();
	afx_msg void OnUpdateRed(CCmdUI *pCmdUI);

  afx_msg void OnCrossLinksManager();

  BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR,   LRESULT *pResult);

	afx_msg void OnDestroy();

	afx_msg void OnOptionsRememberlast();
	afx_msg void OnUpdateRememberlast(CCmdUI *pCmdUI);
	afx_msg void OnOptionsDevotional();
	afx_msg void OnUpdateOptionsDevotional(CCmdUI *pCmdUI);
	afx_msg void OnClose();
	afx_msg void OnQuickVerseGo();
  afx_msg void OnQuickVerseDropDown();
	virtual void OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState);
	virtual BOOL PreTranslateMessage(MSG* pMsg);

	BOOL GoToBibleVerse(CString& verse);
  void AddCurrentVerseToHistory();
	void SavePosition();
	void RestorePosition();

	void SaveQuickHistory();
	void LoadQuickHistory();

  void CreateMainMenu();
  afx_msg void OnMail();
  afx_msg void OnDonate();
  afx_msg void OnLanguage(UINT nID);
  afx_msg void OnUpdateLanguage(CCmdUI* pCmdUI);

};


